خرید بک لینک

Vote count: -1

I have an array which contains 4 different objects and looks like this:

[ { a: 1, b: 12, c: 3 }, { a: 15, d: 1, e: 8 }, {b: 2, d:6 }, {a: 1} ]

I want to retu one object with the sum of each object's values added together.

I am looking to retu the following object:

{a: 17, b: 14, c: 3, d: 7; e: 8}

I have attempted many different solutions, and also checked here for which I surprisingly could not find a solution. This was as close as I found, but could still not solve the issue.

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 22:38

Vote count: 0

I can't get Fancybox to work on my site

JQuery is doing 3 things on this page: Showing and Hiding the various sections of the site, a Carousel for menus, and Fancybox.

On a previous version of the site, there were no carousel menus, and Fancybox worked fine, so I have to think there's a conflict between Carousel and Fancybox.

I resolved a previous conflict between Carousel and the Show/Hide feature by changing their order in the head.

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 22:38

Vote count: 0

Hello i am fairly new to programming in C and basically the decrypt array only holds the first value entered into in below is my code also any tips to help me improve are appreciated;

int main(int argc, char *argv[]) {
char input[100] = "";
char target[0] = "";
char replace[0] = "";
char keycipher[100] = "";
int i, size;
static char decrypt[100] = "";

 while(1){
    printf("nEnter Target: ");
    fgets(target, 17, stdin); 

    printf("Replace With: ");
    fgets(replace, 17, stdin);

    for(i = 0; i < size; i++)
    {
        if(input[i] == target[0]) {
           decrypt[i] = target[i];<-this is where it is supposed to be added
            input[i] = replace[0];
            printf("n%s",input);
            printf("n%s",decrypt);
        } 
    }

    if(target[0] == 'q' || replace[0] == 'q'){
          break;
    }
}

printf("decryt @# %s", decrypt);
printf("nDecrypting .....n");
printf("Your orginal string was: ");

for(i = 0; i < 100; i++)
    {
        input[i] = decrypt[i];
        printf("%s", input);
    }

printf("nSIMULATION OVER!n");

system("PAUSE");
retu 0;
}

the output i receive is as follows;

*--------------------------*
| Welcome to the Scrambler |    
*--------------------------*
  Remember press q to quit

Please enter a string: hello stranger
you entered: hello stranger

Enter target: h
Replace with: w

wello stranger
decrypt array: h

Enter target: s
Replace with: p

wello ptranger
decrypt array: h <-------- why is this still just h?

Enter target: q
Replace with: 

decrypt holds: h <---------- 
Decrypting .....
Your original string was: hello ptrangerhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

SIMULATION OVER!

also how can i check if the target is already in the array so they can`t add that character?

asked 2 mins ago

1 Answer

Vote count: 0

The problem is in

char target[0] = "";
char replace[0] = "";

zero-length arrays caot be used meaningfully.

answered 12 secs ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 22:38

Vote count: 0

Whenever I try to create a new student, my code just doesn't work, regardless of my entry. This method should split a string at a space, and if there are 0 spaces, or more than two, then an error message should be printed, and the value of name shouldn't change. If there is one space present, then the substring before the space becomes firstName and the substring after becomes lastName. If there are two spaces, then the substring before the first space becomes firstName, the one after the first space becomes middleName, and the one after the second space becomes lastName. I'm not sure what I am doing wrong here since my code compiles, but whenever I try to call this method, no student is created.

public void setName(String newName)
{   

    String[] nameInput = newName.split(" ");
    int count = 0;
    int i = 0;
    for (String userName : nameInput)
    {
        while(i < newName.length())
            if(newName.charAt(i) == ' ')
            {
                count++;
            }
        if (count == 0)
        {
            System.out.println("Error, please enter at least two names.");
            newName = null;
        }
        else if(count==1)
        {
            firstName = nameInput[1];
            middleName = "";
            lastName = nameInput[2];
            newName = firstName + " " + lastName;
        }
        else if(count == 2)
        {
            firstName = nameInput[1];
            middleName = nameInput[2];
            lastName = nameInput[3];
            newName = firstName + middleName + lastName;

        }

        else
        {
            System.out.println("Error! You can only enter up to three names.");

        }



    }
}

asked 54 secs ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 12:36

Vote count: 0

What I want is that output date should vary according to the input date and value selected of days to stay(d_stay),that is outputdate=inputdate(i_d)+value(d_stay),and it should change dynamically ,without refreshing the page.

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
          <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
          <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
    <script>
    $(function () {
        var dataSrc = ["australia", "austria", "antartica", "argentina", "algeria"];

        $("#myText").autocomplete({minLength:3,source:dataSrc });
    });
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Make MY TRIP</title>
    </head>

    <body>
    <?php
    If(isset($_REQUEST['submit'])!='')
    {
    If($_REQUEST['s_state']=='' || $_REQUEST['s_date']=='' || $_REQUEST['myText']=='')
    {
    Echo "please fill the empty field.";
    }

    Else
    {
    $s=$_POST["myText"];
    $i_d=$_POST["s_date"];

     $date = DateTime::createFromFormat("Y-m-d", $i_d);
    echo "Inputdate";echo "&nbsp";
     echo $date->format("d F");
    echo "&nbsp";
    echo "&nbsp";
    // echo "out date";


    echo "

    <html>
    <head>
    <body>
    <form method='Post'>
    <select name='d_stay'>
    <option value='1'>1</option>
    <option value='2'>2</option>
    <option value='3'>3</option>
    <option value='4'>4</option>
    <option value='5'>5</option>
    <option value='6'>6</option>
    <option value='7'>7</option>
    </select>
    </body>
    </head>
    </html>
    ";

    }
    }
    ?>
    <p>
    Starting City
    <form method="post" action="23.php">
    <select name="s_state">
      <option value="Shimla">Shimla</option>
      <option value="Delhi">Delhi</option>
      <option value="Chandigarh">Chandigarh</option>
      <option value="Pune">Pune</option>
    </select>

    Starting date
    <input type="date" name="s_date" />
    <p>

    <input id="myText" placeholder="Add city you wish to travel" name="myText"  role="textbox"/>
    </p>
    <input type="submit" name="submit" value="submit" />
    </form>

    </p>

    </body>
    </html>

asked 58 secs ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 12:36

Vote count: 0

I am building a web scraper in CasperJS. I am trying to iterate over the allLinks array which contains all the links I want to scrape. Following are code snippets that I have tried.

1)

casper.then(function(){
      this.each(allLinks,function(self,link){
        console.log("Inside the each function");
        console.log(link);
 (function(link){
        this.thenOpen(link,function(a){
          console.log("Inside function that extracts data");
          console.log(link);
 })(link);
});

     });

2)

casper.then(function(){
    var i = 0;
    var length = allLinks.length;
    var arr = new Array(75);
    //console.log(length);
    //console.log(allLinks);
    casper.repeat(length,function(){
arr[i] = allLinks[i];
        //console.log(length);
        console.log(i);
        link = allLinks[i];

        //console.log("Inside function each ");
        console.log("1" + link);
        //console.log(typeof(link));
        //var eachLink = getLink(link); 
        i++;
        if (i == 74) {
            console.log(arr.length);
        console.log(arr);
        }
});

 });

3)

    casper.then(function(){
        while(j < allLinks.length) {
            console.log("Inside the each function");
            //console.log(allLinks);
            this.thenOpen(allLinks[j],function(a){
                console.log("Inside function that extracts data");
                console.log(j);
                console.log(allLinks[j]);
            };
    j = j + 1;
        });
    });

4)

casper.then(function(){
    for(j = 0; j < allLinks.length; j++) {
        console.log("Inside the each function");
        //console.log(allLinks);
        this.thenOpen(allLinks[j],function(a){
            console.log("Inside function that extracts data");
            console.log(j);
            console.log(allLinks[j]);
        };
    });
});

5)

casper.then(function(){
  this.each(allLinks,function(self,link){
    console.log("Inside the each function");
    console.log(link);
    this.thenOpen(link,function(a){
      console.log("Inside function that extracts data");
      console.log(link);
};
        });
    });

asked 50 secs ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 12:36

Vote count: 0

I have a datetime value to pass into SqlParameter. DateTime object value

However when pass to myCmd.Parameters.Add("@TrxDate", adt_TrxDate); SqlParameter SqlValue & Value property is difference value

Found that it add a day when executing query. I found this issue in profiler and finally find out SqlParameter SqlValue & Value property is difference value. Why it is happen and any idea?

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 8:14

Vote count: 0

i have a service with this code

public class service extends Service{

private AlarmManager alarm;
private PendingIntent addData, sendData, fullData;

// run on another Thread to avoid crash
private Handler mHandler = new Handler();

@Override
public IBinder onBind(Intent intent) {
    retu null;
}

@Override
public void onDestroy() {
    if(!App.User.GetUserCode().equals("")){
        App.DataFrame.InfoLog("Location is tued OFF");
        App.DataFrame.Off();

        mHandler.postDelayed(new Ruable() {
            @Override
            public void run() {
                stopAlarm();

                Intent stoploc = new Intent(service.this, LocationProvider.class);
                service.this.stopService(stoploc);

                stopForeground(true);
                stopSelf();

                App.User.Logout();
                App.Toast("Stopping Service");

            }
        }, 1000);

    }else{
        stopAlarm();

        Intent stoploc = new Intent(service.this, LocationProvider.class);
        service.this.stopService(stoploc);

        stopForeground(true);
        stopSelf();

        App.Toast("Stopping Service");
    }
    super.onDestroy();
}

public void stopAlarm(){
    alarm.cancel(addData);
    alarm.cancel(sendData);
    alarm.cancel(fullData);
}

@Override
public void onCreate() {
    App.Toast("Starting Services");

    alarm = (AlarmManager) getSystemService(App.GetContext().ALARM_SERVICE);

    Intent intent = new Intent(this, CoorReceiver.class);
    addData = PendingIntent.getBroadcast(this, 0, intent.putExtra("Code", 0), PendingIntent.FLAG_UPDATE_CURRENT);
    sendData =  PendingIntent.getBroadcast(this, 1, intent.putExtra("Code", 1), PendingIntent.FLAG_UPDATE_CURRENT);
    fullData =  PendingIntent.getBroadcast(this, 2, intent.putExtra("Code", 2), PendingIntent.FLAG_UPDATE_CURRENT);
    alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, 15000, 15000, addData);
    alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, 300000, 300000, sendData);
    alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, 600000, 600000, fullData);
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Intent intent2 = new Intent(this, MainActivity.class);

    intent2.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent pendIntent = PendingIntent.getActivity(this, 0, intent2, 0);

    Notification noti = new Notification.Builder(getApplicationContext())
            .setContentTitle("Imagine")
            .setContentText("Service is Ruing")
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentIntent(pendIntent)
            .build();
    startForeground(1234, noti);
    retu START_STICKY;
}
}

and a broadcastreceiver

public class CoorReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
    int code = intent.getIntExtra("Code", 0);
    if(code == 0){
        App.DataFrame.AddPresentCoordinate();
        App.Toast("Get");
        try{
            if(App.Location.IsNetworkEnabled() == false && App.Location.IsGPSEnabled() == false){
                context.stopService(new Intent(context, service.class));
            }
        }catch (RuntimeException e){
            App.DataFrame.ErrorLog("Checking GPS Status", e.getMessage());
        }
    }else if(code == 1){
        App.DataFrame.SendValidData();
        App.Toast("Send");
    }else if(code == 2){
        App.DataFrame.SendFullData();
        App.Toast("Full");
    }
}
}

when I plug my phone to my PC via usb and do debugging with a few breakpoint, the alarm will call receiver every 15s, 5min, and 10min
but when I generate the signed apk(release or debug), the alarm won't call the receiver
does anyone have same problem? or any solution?

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 8:14

Vote count: 0

guys and gals! I'm pretty new to Ruby and I've run across a problem with something that I'm not entirely sure how to work.

As a challenge, a friend told me to create a program that determines whether or not a person can participate in an activity based on their height. If their height in centimeters/inches/whatever is a perfect square, then they can go, if not, they can't. This is what I have now:

print "Input height here:"

def height_input
    input = gets.to_i
    input**0.5
end

if height_input.integer?
    print "Congrats, you're in!"
else
    print "Sorry, we can't let you in."
end

I'm certain that the last 'if' statement doesn't work the way I want it to because the method retus a float value (example: input=64 => 8.0) and not a normal, whole number integer. If I add a (.to_i) to the end of the method, or if I call the method to make the value an integer, it gives me the first digit of the root in integer form. That isn't bad if I do in fact have a perfect square, but if it's not a perfect square, then I get the same result as if I did. Help?

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 8:14

Vote count: 0

Subject: MyBatis: Boolean Paraeter: MyBatis is using Getter

Content:

Hello everyone,

I have been searching for a while for a solution to my nearly-simple MyBatis problem:


Given code (only the necessary parts):

mybatis-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <typeAliases>
        <!-- Model types. -->
        <typeAlias type="com.blockhaus2000.bh2k.portal.data.model.Navigation" alias="Navigation" />
        <!-- ... more types ... --->
    </typeAliases>
    <mappers>
        <mapper resource="mapper/NavigationDAO.xml" />
        <!-- ... more mappers ... -->
    </mappers>
</configuration>

NavigationDAO.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.blockhaus2000.bh2k.portal.data.dao.NavigationDAO">
    <resultMap type="Navigation" id="navigationResultMap">
        <id property="id" column="navigationId" />
        <result property="title" column="navigationTitle" />
        <result property="order" column="navigationOrder" />
        <result property="visible" column="navigationVisible" />
        <discriminator javaType="String" column="resolve">
            <case value="yes" resultMap="enhancedNavigationResultMap" />
        </discriminator>
    </resultMap>
    <resultMap type="Navigation" id="enhancedNavigationResultMap" extends="navigationResultMap">
        <collection property="navigationEntries" ofType="NavigationEntry">
            <id property="navigationId" column="navigationId" />
            <id property="pageId" column="pageId" />
            <result property="title" column="navigationEntryTitle" />
            <result property="order" column="navigationEntryOrder" />
            <result property="visible" column="navigationEntryVisible" />
        </collection>
    </resultMap>

    <!-- Methods from BaseDAO. -->
    <insert id="insert" parameterType="Navigation" useGeneratedKeys="true" keyProperty="id" keyColumn="navigationId">
        <!-- SQL -->
    </insert>
    <insert id="save" parameterType="Navigation">
        <!-- SQL -->
    </insert>
    <delete id="delete" parameterType="Navigation">
        <!-- SQL -->
    </delete>
    <select id="exists" parameterType="Navigation" resultType="boolean">
        <!-- SQL -->
    </select>

    <!-- Methods from UpdateableDAO. -->
    <update id="update" parameterType="Navigation">
        <!-- SQL -->
    </update>

    <!-- Methods from NavigationDAO. -->
    <select id="findVisibleNavigations" parameterType="boolean" resultMap="navigationResultMap">
        SELECT
            N.navigationId,
            N.navigationTitle,
            N.navigationOrder,
            N.navigationVisible,
        <if test="resolve">
            NE.pageId,
            NE.navigationEntryTitle,
            NE.NavigationEntryOrder,
            NE.navigationEntryVisible,
        </if>
            IF (
                #{resolve} = 'true',
                'yes',
                'no'
            ) AS resolve
        FROM
            Navigation AS N
        <if test="resolve">
        INNER JOIN NavigationEntry AS NE ON N.navigationId = NE.navigationId
        </if>
        WHERE
            N.navigationVisible = TRUE
        <if test="resolve">
            AND
            NE.navigationEntryVisible = TRUE
            AND
            NE.navigationEntryTitle IS NOT NULL
        </if>
    </select>
    <select id="findHiddenNavigations" parameterType="boolean" resultMap="navigationResultMap">
        <!-- SQL -->
    </select>
    <select id="findNavigation" parameterType="Map" resultMap="navigationResultMap">
        <!-- SQL -->
    </select>
</mapper>

NavigationDAO.java:

package com.blockhaus2000.bh2k.portal.data.dao;

import java.util.SortedSet;

import com.blockhaus2000.bh2k.portal.data.model.Navigation;

public interface NavigationDAO extends BaseDAO<Navigation>, UpdateableDAO<Navigation> {
    SortedSet<Navigation> findVisibleNavigations(final boolean resolve);

    SortedSet<Navigation> findHiddenNavigations(final boolean resolve);

    Navigation findNavigation(final int id, final boolean resolve);
}

BaseDAO.java:

package com.blockhaus2000.bh2k.portal.data.dao;

import com.blockhaus2000.bh2k.portal.data.model.BaseModel;

public interface BaseDAO<T extends BaseModel<T>> {
    int insert(final T obj);

    int save(final T obj);

    int delete(final T obj);

    boolean exists(final T obj);
}

UpdateableDAO.java:

package com.blockhaus2000.bh2k.portal.data.dao;

import com.blockhaus2000.bh2k.portal.data.model.BaseModel;

public interface UpdateableDAO<T extends BaseModel<T>> extends BaseDAO<T> {
    int update(final T obj);
}


Everything is starting correctly, but on an invocation of

NavigationDAO.findVisibleNavigations(true) // Or false.

the following Exception is thrown:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'resolve' in 'class java.lang.Boolean'
    at org.mybatis.(...)
    at org.apache.ibatis.(...)
    at com.blockhaus2000.bh2k.portal.data.test.NavigationDAOSpec.test findVisibleNavigations(NavigationDAOSpec.groovy:224)
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'resolve' in 'class java.lang.Boolean'
    at org.apache.ibatis.(...)
    at org.mybatis.(...)
    ... 5 more


That said, the solution may be to change the "parameterType" to "Map" and replacing "resolve" with "param1". But that does not work either. Also, if I remove the

<if test="..."> ... </if>

it does execute correctly (except for the functionaility, of course).


I am happy about every single answer.

Thanks for your help Fabian

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 6:56

Vote count: 0

After the first training stage, the proccess is taking a lifetime to be completed. The parameters used are:

Raphaels-MacBook-Air:test19_volumeup_lessneg raphaelsantos$ opencv_traincascade -vec pos.vec -numPos 300 -bg negdir.txt -numNeg 20 -numStages 2 -data 1stage -w 60 -h 60 PARAMETERS: cascadeDirName: 1stage vecFileName: pos.vec bgFileName: negdir.txt numPos: 300 numNeg: 20 numStages: 2 precalcValBufSize[Mb] : 1024 precalcIdxBufSize[Mb] : 1024 acceptanceRatioBreakValue : -1 stageType: BOOST featureType: HAAR sampleWidth: 60 sampleHeight: 60 boostType: GAB minHitRate: 0.995 maxFalseAlarmRate: 0.5 weightTrimRate: 0.95 maxDepth: 1 maxWeakCount: 100 mode: BASIC

===== TRAINING 0-stage ===== END> Training until now has taken 0 days 0 hours 3 minutes 51 seconds.

===== TRAINING 1-stage =====

"RIGHT HERE THE TRAINING GETS BLOCKED, ANY IDEA WHY?!?"

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 6:56

Vote count: 0

I have number of html files and each file has

<p>Some string</p>
<p>Some text</p>
<p>Some other text</p>
<p>Above this i want to add a string</p>
<p>Completed On: dd.mm.yyyy</p>

Rest of HTML page

The string "Completed On:" occurs only once in entire page.

Above the "Above this i want to add a string" --para I want to add a string say -- IDENTIFIER01.

The text Above this i want to add a string is variable and not fixed like Completed On: else i would have used patte matching.

How can this be done in PHP?

I am reading the file and keeping only needed html tags

$html = file_get_contents('file.html');
$strip = strip_tags("$html","<b>,<p>,<br>,<blockquote>,<ul>,<ol>,<li>,<u>,<i>,");

So would want to update $strip to add the string IDENTIFIER01 before moving to next stage of the code.

Thanks.

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 2:37

Vote count: 0

I have website with array (list) of 1000 objects, these objects are loading from json to array every website refresh. I would like to load these objects from json to array only once and keep it in RAM for others users. Because everytime read file is much slower than read it from RAM.

I am using ASP.NET Web Forms

How is it posssible?

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 2:37

Vote count: 0

I am facing some issue in xamarin.forms(in IOS) while using menuitem under context action in xamarin.forms listview. When i swipe the swipe menuitem works fine. But i do not want this menu item come under context action if some condition is met. Scenario-Suppose in xamarin listview i have selected row with value two then menuitem should come when i do swip. This is working fine. When i click on the menuitem it deletes the selected item and reset the listitem to value(zero) in this case i do not want the menu item to come with this when i do swip. Now if i again select any other value in listview then menu item should come when i do swip.So it kind of visibility change but there is no property in context action/menuitem. Note i am using MVVM Patte. Please try to provide solution in that way. Thanks In Advance.

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: جمعه 30 بهمن 1394 ساعت: 2:37

Vote count: 0

I have written the following (very simple) ring buffer class, which should allow array access via the @:arrayAccess macro:

class RingBuffer<T>
{
    private var _elements : Array<T> = null;

    public function new(p_numElements : Int, p_defaultValue : T)
    {
        _elements = new Array<T>();

        for (i in 0 ... p_numElements)
        {
            _elements.push(p_defaultValue);
        }
    }

    public function add(p_value : T) : Void
    {
        // Remove the first element
        _elements.splice(0, 1);
        _elements.push(p_value);
    }


    @:arrayAccess public inline function get(p_index : Int)
    {
      retu _elements[p_index];
    }

    @:arrayAccess public inline function set(p_index : Int, p_value : T)
    {
        _elements[p_index] = p_value;
        retu p_value;
    }
}

But when I try to use array access on an instance of the class, I get an error telling me "Array access is not allowed on...".

Did I do something wrong in using the macro? I was basically following the example in the manual.

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 20:39

Vote count: 0

I'm making a game with Unity where player pick up a cookie and then player is jumping on y-axis. When player is jumping, he is twitching(very much). I want that jump and I want see that player is jumping smoothly. This is my sample of code

void OnTriggerEnter2D(Collider2D other)
{
    if(other.gameObject.CompareTag("Player"))
    {
    player.velocity = new Vector2 (0, 0);
    player.AddForce(new Vector2(0,jumpHeight));
}

I tested about 1000f value of jumpHeight. Same problem is with higer or lower value.

Thanks and kind regards

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 20:39

Vote count: 0

in LAContext.h

/// @discussion This property can be set with a time interval in seconds. If the device was successfully unlocked by Touch ID within this time interval, then Touch ID authentication on this context will succeed automatically and the reply block will be called without prompting user for Touch ID.The default value is 0, meaning that no previous TouchID authentication can be reused.The maximum supported interval is 5 minutes and setting the value beyond 5 minutes does not increase the accepted interval.

@property (nonatomic) NSTimeInterval touchIDAuthenticationAllowableReuseDuration NS_AVAILABLE_IOS(9_0);

But When I Use this property has no effect

  • (void)viewDidLoad { [super viewDidLoad];

    self.transitioningDelegate = self; self.modalPresentationStyle = UIModalPresentationCustom;

    self.context.touchIDAuthenticationAllowableReuseDuration = 5;

    [self authenticationWithtouchID];

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self authenticationWithtouchID]; }); }

after 15 second,Ther context's TouchID still authentication can be Available

whats wrong????

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 13:13

Vote count: 0

I'm trying to apply a HTML Bootstrap theme to a Rails application where I use HAML. The result can be found here: http://imgur.com/hhprZgh.

There seem to be some places in the code where I'm not converting it properly. Can you point out where those places might be? I can see in the console that all CSS files are loaded properly. Don't mind the fonts for now.

Thanks!

(It's the Moltran Responsive Admin Theme I'm using)

HAML:

.wrapper-page
  .panel.panel-color.panel-primary.panel-pages
    .panel-heading.bg-img
      .bg-overlay
      %h3.text-center.m-t-10.text-white Sign In to Founderdocs
  .panel-body
    = form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
      %fieldset.form-control.input-lg
        .col-xs-12
          = f.label :email
          = f.email_field :email, placeholder: User.human_attribute_name('email'), class: 'form-control'
      %fieldset.form-control.input-lg
        .col-xs-12
          = f.label :password
          = f.password_field :password, placeholder: User.human_attribute_name('password'), class: 'form-control'
      .form-group
        .col-xs-12
          - if devise_mapping.rememberable?
            .checkbox.checkbox-primary
              = f.label :remember_me do
                = f.check_box :remember_me
                Remember me
      .form-group.text-center.m-t-40
        .col-xs-12
          = f.submit t('.sign_in'), class: 'btn btn-primary'
      .form-group.m-t-30
        .col-sm-7
          %i.fa.fa-lock.m-r-5
            = render 'devise/shared/linkdump'
        .col-sm-5.text-right
          %a{:href => "register.html"} Create an account

HTML:

<div class="wrapper-page">
    <div class="panel panel-color panel-primary panel-pages">
        <div class="panel-heading bg-img"> 
            <div class="bg-overlay"></div>
            <h3 class="text-center m-t-10 text-white"> Sign In to <strong>Moltran</strong> </h3>
        </div> 


        <div class="panel-body">
        <form class="form-horizontal m-t-20" action="index.html">

            <div class="form-group">
                <div class="col-xs-12">
                    <input class="form-control input-lg" type="text" required="" placeholder="Useame">
                </div>
            </div>

            <div class="form-group">
                <div class="col-xs-12">
                    <input class="form-control input-lg" type="password" required="" placeholder="Password">
                </div>
            </div>

            <div class="form-group">
                <div class="col-xs-12">
                    <div class="checkbox checkbox-primary">
                        <input id="checkbox-signup" type="checkbox">
                        <label for="checkbox-signup">
                            Remember me
                        </label>
                    </div>

                </div>
            </div>

            <div class="form-group text-center m-t-40">
                <div class="col-xs-12">
                    <button class="btn btn-primary btn-lg w-lg waves-effect waves-light" type="submit">Log In</button>
                </div>
            </div>

            <div class="form-group m-t-30">
                <div class="col-sm-7">
                    <a href="recoverpw.html"><i class="fa fa-lock m-r-5"></i> Forgot your password?</a>
                </div>
                <div class="col-sm-5 text-right">
                    <a href="register.html">Create an account</a>
                </div>
            </div>
        </form> 
        </div>                                 

    </div>
</div>

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 13:13

Vote count: 0

I have an EC2 instance on Amazon (AWS). The instance is behind a ELB (Elastic Load Balancer). I want to allow HTTPS coections to reach the EC2 instance.

Is it necessary to have the load balancer configured for HTTPS, ie, to check the certificates etc, or can this just be done traditionally within the EC2 instance and virtual host SSL configuration ?

The reason I'm asking is because I have allowed traffic via ELB -> EC2 for port 80 and 443, but only port 80 reaches the instance.

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 13:13

Vote count: 0

I am developing SpriteKit universal iOS application that will contain many spritekit images. I was wondering if there are better methods for working with large amount of data images in iOS apps from what's available as default from Apple (i.e. texture atlases or image assets). Some resources point out that working with a database, like SQL, to save and load images data to/from a disk, improves the overall app performance in terms of memory resources.

What is the really best way to manage images content in the iOS application?

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 9:30

Vote count: -1

I found this code here in stackoverflow and it says it can select from a random row database but i am having trouble understanding how the code functions and i also do not know how to apply it to my own php script. Im not sure how i should write it to the syntax and also if i need to add other things to it so i can function to get 10 random rows, also after getting the rows how would i put the results into a csv.output or a variable so i can extract it from my app. I am trying to do what this guy did http://www.newthinktank.com/2014/05/coect-app-inventor-mysql-database/ if you look at his first script it has a csv.output thing and i want the rows gotten to be put into a csv.output.

(this is the section i dont understand how it functions or how to add to  the script)    
SELECT name
  FROM random AS r1 JOIN
       (SELECT (RAND() *
                     (SELECT MAX(id)
                        FROM random)) AS id)
        AS r2
 WHERE r1.id >= r2.id
 ORDER BY r1.id ASC
 LIMIT 1;

My code:

<?php 

DEFINE ('DBUSER', ''); 
DEFINE ('DBPW', ''); 
DEFINE ('DBHOST', ''); 
DEFINE ('DBNAME', ''); 

$dbc = mysqli_coect(DBHOST,DBUSER,DBPW);
if (!$dbc) {
    die("Database coection failed: " . mysqli_error($dbc));
    exit();
}

$dbs = mysqli_select_db($dbc, DBNAME);
if (!$dbs) {
    die("Database selection failed: " . mysqli_error($dbc));
    exit(); 
}

SELECT name
  FROM random AS r1 JOIN
       (SELECT (RAND() *
                     (SELECT MAX(id)
                        FROM random)) AS id)
        AS r2
 WHERE r1.id >= r2.id
 ORDER BY r1.id ASC
 LIMIT 1;
 ?>

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 9:30

Vote count: 0

Its been a while since I have worked with classes, im slowly getting back into the mix. I have this Bogo Sort and I see it loop a bunch of time right after "int center" in the bogosort function. Can anyone help me figure out why exactly it gets stuck at the next calling function. I made sure I made &left and &right constants.

#include <algorithm>
#include <vector>
#include <iostream>
#include <iterator>
using namespace std;



void bogosort(vector<int> & a, const int &left, const int &right) {

int center = (left + right) / 2;

bogosort(a, left, center);

bogosort(a, center + 1, right);
cout << "good";
if (a[center] > a[right]) {
    swap(a[center], a[right]);
}
bogosort(a, left, right - 1);

//retu 0;
}


int main() {
vector<int> myVector;
vector<int>::iterator it;

myVector = { 100, 2, 5, 52, 13, 55, 89, 14, 1, 99 };
int left = 0;
int right = 9;
//int fs;
for (it = myVector.begin(); it != myVector.end(); ++it) {
    cout << ' ' << *it;
}

bogosort(myVector, left, right);

for (it = myVector.begin(); it != myVector.end(); ++it) {
    cout << ' ' << *it;
}
retu 0;
}

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 9:30

Vote count: 0

Given a mesh consisting of a list of vertices (2D coordinates) and edges (as vertex pairs), like so:

Mesh

So the edges are defined like this:

a: 2,3 
b: 3,4
c: 4,8
d: 5,8
e: 6,7
etc..

Edges are orientation-neutral, i.e. the order of any two vertices that define an edge is random (edges are not clockwise or counter clockwise).

Polygons may be convex or concave, but they never overlap or self-intersect (edges never cross eachother).

Question: how do I generate a list of all polygons?

More specifically, in the above example I would need 4 polygons, like so:

(a,b,c,d,i)
(d,g,h)
(f,i,j,k)
(e,h,k)

The polygons have no orientation either, clockwise or counterclockwise does not apply, and in fact the order of the edges that define a polygon may be random as well. For example (a,i,d,b,c) for the 5-sided one would be fine as well.

Instead of defining polygons as a list of edges, it could also be a list of coected vertices, like so:

(2,3,4,8,5)
(6,5,8)
(2,5,7,1)
(7,6,5)

In this case, the order of the vertices caot be random (the list of vertices should be a circular sequence) but orientation (clockwise or counterclockwise) is still irrelevant. So the 4-sided polygon could also be (5,2,1,7) or (1,7,5,2) et cetera.

What is an efficient (fast) way to construct a list of polygons, defined in either edges or vertices?

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 4:25

Vote count: 0

i am working on a project with node.js(not express) server and mysql database. So what it does is that when user clicks a desired button on html page,it uploads 2 values (say SpecificName, Yes/No). Now these values goes in the mysql database through node server.Later mysql runs a check for the specificName column(if no then creates a column with the same Name) and updates the second value in it.

Now i would like to keep every update of the second value that the user makes through website (i.e yes) for 5 minutes in mysql after which it automatically updates the the specific location with another value (say cancel).I'm auspicious in solving every thing except this 5 minutes paradox.Also I'm keeping 15-20 so called specificName columns in which the value (say yes/no) is being updated and at the same time there are more than 1000 rows that are working simultaneously so a lots of 5 minute timers going on for the values.Is there a way to store value temporarily in mysql after which it is destroyed automatically?.

I came across : 1)node-crons(too complex,dnt even know if its a right choice), 2)mysql events(idk how to use it with node), 3)timestamp(can't create more than one timestamp(guess i need one for each column)), 4)datetime(haven't tested it yet).and other things like (DELETE FROM table WHERE timestamp > DATE_SUB(NOW(), INTERVAL 5 MINUTE)). Now i hv no idea what to use or how to resolve this dilemma. PLZZ HELP.

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 4:25

Vote count: 0

my first post so be gentle... I have a PHP contact form where on a php page (contact.php)

<form id="contact" method="post" action="send.php">

On clicking the send button the data goes to the send.php script to be validated. If passes validation, the user views a sent.html page where the message "Your Message Has Been Sent - Thank You" is displayed

$message = "Your Message Has Been Sent - Thank You";
include "sent.html";

However if validation fails, for example, if a field is left blank the validation fails the send & the $message is displayed on the within the form, back on the on the contact.php...

if ((!$fname) OR (!$lname) OR (!$email) OR (!$enquiry))
{
$message = "ERROR: ALL FEILDS MARKED * MUST BE COMPLETED";
include "contact.php";
exit();

The message is displayed on the contact.php page form using:

<?php 
    print "$message";
?>

This is operational, but the form is halfway down the page and the user has to scroll down to view the failed sending of the message, which could be missed, and views poorly... How can I ensure that on failed validation the contact.php page is displayed with the form at the top of the page? Can I apply an anchor, or a method or retuing to the form id? Thanks in advance.

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 4:25

Vote count: 0

I am wondering how you can explicitly set the logstash-forwarder log file location. For some reason I don't see any options for this. For my Linux VM's, it is not a (big) problem as they get stored in /var/log/logstash-forwarder/ however in Windows, I caot seem to find them anywhere.

I looked around with the options when ruing logstash-forwarder -help, but it doesn't seem to provide any options. Google doesn't help either.

I have tried -syslog=true / -log-t-syslog=true which doesn't seem to do anything.

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 2:50

Vote count: 0

I'm a super begier when it comes to Javascript/JQuery/HTML in general, apologies if my question is confusing. I'm trying to update legacy code front-end to use the JQuery datepicker instead of an old drop down menu. The back-end code (that I shouldn't change) uses a string variable for day, month, and year. I'm trying to save the values from datepicker directly into the bean, using the following js:

<script>
    $(function() {
        $(".datepicker").datepicker({
            dateFormat: "yy-mm-dd",
            changeYear: true,
            changeMonth: true,
            onSelect: function(dateText, inst) { 
                var date = $(this).datepicker('getDate');
                document.getElementById('enterAppForm:effectiveDay').value  = date.getDate();  
                document.getElementById('enterAppForm:effectiveMonth').value = date.getMonth() + 1;              
                document.getElementById('enterAppForm:effectiveYear').value =  date.getFullYear();
            }
        });
    });
</script>

I have the HTML as (inside <h:form id="enterAppForm"> with a lot of other things):

<h:inputText type="text" class="datepicker" id="effectiveDate" name="effectiveDate" />
<h:inputHidden id="effectiveDay" value="#{beanName.effectiveDay}" />
<h:inputHidden id="effectiveMonth" value="#{beanName.effectiveMonth}" />
<h:inputHidden id="effectiveYear" value="#{beanName.effectiveYear}" />

If I do something like:

day  = date.getDate(),  
month = date.getMonth() + 1,              
year =  date.getFullYear();
alert(day + '-' + month + '-' + year);

the values do show up correctly. However, the bean shows that it's receiving values of null for all 3 variables. I'm sure there's something basic that I'm not understanding, so if anyone can point me towards the right direction, I'd really appreciate it. I've seen examples with PrimeFaces, but this project doesn't use it.

P.S. This step would probably be trivial after I figure out my issue, but a validation js needs to grab var vEffectiveMonth = document.getElementById('enterAppForm:effectiveMonth'); for it to work. It shouldn't matter it's a hidden field, right? It was linked to the old drop down menu before.

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 2:50

Vote count: 0

I'm trying to access the next line using fgets in order to count the number of lines that are similar to the next one, is there anyway to get the NEXTLINE variable?

similar = 0;
char line[100]
FILE *f = fopen(file, "r");
while (fgets(line, 100, f)) {
            if (strcmp(NEXTLINE, line) == '0') {
                      similar++;
            }
asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 2:50

Vote count: 0

my code for creating events, sharing them with others and sending invites/notifications works perfectly.

But what if my code gets somehow stuck in a loop and creating events repeatedly? May I wake up some day with thousands of invites in my mailbox? Is there something like a spam-protection? :D

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 0:15

Vote count: 0

Hello I need some help with (whenever I identify a certain object within the code that the color coincides with that object?) An example of the code is below.

<Placemark>
    <name>**JACKS RUN RD CABLE #1___364**_</name>
    <description><![CDATA[<br><br><br>
<table border="1" padding="0">
<tr><td>Cable_Id</td><td>364</td></tr>
<tr><td>Cable_Name</td><td>JACKS RUN RD CABLE #1</td></tr>
<tr><td>Segment_Id</td><td>364-1</td></tr>
<tr><td>Map_Id</td><td>3283-1</td></tr>
<tr><td>Book_Number</td><td>2</td></tr>
<tr><td>Reference_Drawing</td><td></td></tr>
<tr><td>Cable_Gauge</td><td>19</td></tr>
<tr><td>Cable_Sheathing</td><td>COMM CABLE</td></tr>
<tr><td>Sheath_Pairs</td><td>6</td></tr>
<tr><td>Cable_Pairs</td><td>6</td></tr>
<tr><td>Aerial</td><td>T</td></tr>
<tr><td>Underground</td><td>F</td></tr>
<tr><td>Work_Order</td><td></td></tr>
<tr><td>Narrative</td><td>1/4" MESSENGER</td></tr>]]></description>
    <Style>
        <LineStyle>
            <color>**ff0000ff**</color>
            <width>1.5</width>
        </LineStyle>
    </Style>
    <LineString>
        <extrude>1</extrude>
        <tessellate>1</tessellate>
        <coordinates>
            -80.043832,40.50061,0 -80.04006200000001,40.500929,0 -80.040018,40.500907,0 -80.03644300000001,40.500508,0 -80.035985,40.500468,0 -80.03517100000001,40.50039,0 -80.03325599999999,40.500213,0 -80.032264,40.499884,0 
        </coordinates>
    </LineString>
</Placemark>
<Placemark>

The identifier is in BOLD and the color is in bold. I need the color to change with each different Cable_Name. Any help would be appreciated.

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 29 بهمن 1394 ساعت: 0:15

صفحه بندی